package com.fanhao.dllo.soundfm.fragment;

import android.support.v4.app.FragmentManager;
import android.view.View;
import android.widget.TabHost;

import com.fanhao.dllo.soundfm.R;
import com.fanhao.dllo.soundfm.fragment.Infofragmnet.CoolFragment;
import com.fanhao.dllo.soundfm.fragment.Infofragmnet.PersonFragment;

/**
 * Created by dllo on 16/1/15.
 * 进入app后显示的界面
 */
public class MainFragment extends BaseFragment {
    private TabHost mTabHost;
    private FragmentManager fm;
    @Override
    protected int getLayoutView() {
        return R.layout.fragment_main;
    }

    @Override
    protected void initView() {
        mTabHost = findView(android.R.id.tabhost);
        mTabHost.setup();

        TabHost.TabSpec spec0 = mTabHost.newTabSpec("spec0");
        View tabView0 = getActivity().getLayoutInflater()
                .inflate(R.layout.tabwidget_cool, null);
        spec0.setIndicator(tabView0);
        spec0.setContent(R.id.CoolView);
        mTabHost.addTab(spec0);

        TabHost.TabSpec spec1 = mTabHost.newTabSpec("spec1");
        View tabView1 = getActivity().getLayoutInflater()
                   .inflate(R.layout.tabwidget_person, null);
        spec1.setIndicator(tabView1);
        spec1.setContent(R.id.PersonView);
        mTabHost.addTab(spec1);

        replaceFragment(R.id.CoolView, new CoolFragment());
        replaceFragment(R.id.PersonView, new PersonFragment());

    }

    @Override
    protected void initData() {

    }
}
